package ts.test.service.impl;

import java.lang.reflect.Proxy;

public class IntermediaryJdkProxyFactory {
    /**
     * 工厂方法
     */
    public static <T> T create(Object target){
        IntermediartInvocationHandler handler = new IntermediartInvocationHandler();
        handler.setTarget(target);
        return (T) Proxy.newProxyInstance(target.getClass().getClassLoader(),target.getClass().getInterfaces(),handler);
    }
}
